<template>
	<view class="details">
		<view class="ul">
			<view>
				<image :src="initData.image" mode="widthFix" class="img" />
			</view>
			<view class="flex">
				<text class="text">订单号:</text>
				<text class="right">{{initData.orderSn}}</text>
			</view>
			<view class="flex">
				<text class="text">订单识别码：</text>
				<text class="right">{{initData.identificationCode}} <text @click="copy(initData.identificationCode)" class="copy">复制</text></text>
			</view>
			<view class="flex">
				<text class="text">商品货号：</text>
				<text class="right">{{initData.goodsSn}}</text>
			</view>
			<!--<view class="flex">
				 <text class="text">供应商信息：</text>
		       <text class="right">{{initData.supplierName}}</text>
		   
			</view>-->
			<view class="flex">
				<text class="text">数量：</text>
				<text class="right">1</text>
			</view>
			<view class="flex">
				<text class="text">客户名称：</text>
				<text class="right">{{initData.contactUser}}</text>
			</view>
			<view class="flex">
				<text class="text">联系电话：</text>
				<text class="right">{{initData.contactPhone}}</text>
			</view>
			<view class="flex">
				<text class="text">订单来源：</text>
				<text class="right">{{initData.desp}}</text>
			</view>
			<view class="flex">
				<text class="text">下单时间：</text>
				<text class="right">{{initData.createdTime}}</text>
			</view>
			<!--<view class="flex">
				 <text class="text">审核时间：</text>
		       <text class="right">{{initData.operationTime}}</text>
		   
			</view>-->
			<view class="flex">
				<text class="text">身高 ：</text>
				<text class="right">{{initData.height}}</text>
			</view>
			<view class="flex">
				<text class="text">体重：</text>
				<text class="right">{{initData.weight}}</text>
			</view>
			<!-- <view v-for="item in initData.sku" :key="item.value" >
          <text class="text">{{item}}</text>
        </view> -->
			<view v-for="(item1,index1) in initData.sku" :key="index1">
				<view class="sizr gray flex " v-if="index1==0">
					<text class="text">颜色：</text>
					<text class="right">{{item1.split(":")[1]}}</text>
				</view>
				<view class="sizr gray flex" v-if="index1==1">
					<text class="text">尺码：</text>
					<text class="right">{{item1.split(":")[1]}}</text>
				</view>
			</view>
			<view class="flex">
				<text class="text">下单人：</text>
				<text class="right">{{initData.buyer}}</text>
			</view>
			<view class="flex">
				<text class="text">收货地址：</text>
				<text class="right">{{initData.addrDetail}}</text>
			</view>
			<view class="flex">
				<text class="text">快递单号：</text>
				<text class="right">{{initData.expressSn}}</text>
			</view>
			<view class="flex">
				<text class="text">原递单号：</text>
				<text class="right">{{initData.beforExpressSn}}</text>
			</view>
			<view class="flex" v-if="initData.shipTime">
				<text class="text" >发货时间：</text>
				<text class="right">{{initData.shipTime}}</text>
			</view>
			<view class="flex" v-if="initData.remark">
				<text class="text">备注：</text>
				<text class="right">{{initData.remark}}</text>
			</view>
			<view class="flex">
				<text class="text">物流信息：</text>
				<text class="right">{{initData.logisticsInfo}}</text>
			</view>
			<view class="flex">
				<text class="text">原物流信息：</text>
				<text class="right">{{initData.beforLogisticsInfo}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import commoditydetails from '../../../servers/order/commoditydetails.js';
	export default {
		data() {
			return {
				initData: '',
				id: ''
			};
		},
		onPageScroll: function(e) {
			//nvue暂不支持滚动监听，可用bindingx代替
			if (e.scrollTop > 200) {
				this.is_go_top = true;
			} else {
				this.is_go_top = false;
			}
		},
		mounted() {
			var _this = this
			this.id = uni.getStorageSync('commoditydetails') || this.$route.query.commoditydetails
			if (this.id) {

			}
			this.getDate()
		},
		methods: {
			getDate() {
				var obj = {
					id: this.id
				}
				commoditydetails.initData(obj)
					.then(res => {
						this.initData = res.data;
						this.initData.image = this.imgCDNUrl + this.initData.image;
						var sku = [];
						if (this.initData.productSkuDesp) {
							sku = this.initData.productSkuDesp.split(",");
						}
						console.log(this.initData.productSkuDesp);
						console.log(sku);
						this.initData.sku = sku;
						this.initData.desp = this.initData.orderFrom.desp;
						console.log(this.initData);
					})
					.catch(err => {
						console.log(new Error('请检查网络后重试'));
					});
			},
			copy(value){
				uni.setClipboardData({
				    data: value,
				    success: function () {
				        uni.showToast({
				        	title:'复制成功'
							
				        })
				    }
				});
			}

		}
	};
</script>
<style lang="less" scoped>
	page {
		background: #ffffff;
	}

	.details {
		padding: 20rpx;

		.img {
			width: 100%;
			border: 1px solid #EFEFF4;
		}

		.ul {
			padding: 20px 0;
		}
	}
	.flex{
		display: flex;
		align-items: center;
		margin-bottom: 12px;
		.text{
			flex: 0 0 94px;
			width: 94px;
			font-size: 14px;
			color: #666;
		}
		.copy{
			color: #bd3c8c;
			margin-left: 20rpx;
		}
		.right{
			flex: 1;
			font-size: 14px;
		}
	}
</style>
